<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'userMain.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	<link rel="stylesheet" type="text/css" href="css/common.css">

  </head>
  
  <body>
  	<div id="bookselect">
  		<s:iterator value="%{bookList}">
  			<div class="book">
  				<img class="bookphoto" alt="<s:property value='title' />" src="<s:property value='picturePath' />"/>
  				<TABLE>
  					<TR>
  						<td align="left">
  						<table class="information">
  							<tr>
  								<td class="title"><s:property value="title"/></td>
  							</tr>
  							<tr>
  								<td>作者：<s:property value="author"/></td>
  							</tr>
  							<tr>
  								<td>单价：<s:property value="price"/></td>
  							</tr>
  							<tr>
  								<td><a class="detail" href="jsp_user_bookdetail?bookId=<s:property value='%{bookId}' />">详情<font style="font-size:9px"></font></a></td>
  							</tr>
  							<tr>
  								<td><a class="addbuy" href="jsp_user_addshopcar.action?bookId=<s:property value='%{bookId}' />" target="centerframe">加入购物车</a></td>
  							</tr>
  						</table>
  						</td>
  					</TR>
  				</TABLE>
  						
  				</div>
  		</s:iterator>
  		<s:if test="%{cnt==0}">
    		<span>抱歉，暂时没有图书</span>
    	</s:if>
    	<s:else>
    		<div id="div_page">
    			<span class="sumbook">共检索到<s:property value="cnt"/>条记录</span>
    			<span class="sumpage">共<s:property value="%{cnt/@com.action.UserBookSelectAction@SIZE+(cnt%@com.action.UserBookSelectAction@SIZE!=0?1:0)}"/>页
	    				当前第<s:property value="%{curPos/@com.action.UserBookSelectAction@SIZE+1}" />页
	    				<s:if test="%{curPos!=1}">							
	    					<a href="jsp_user_bookselect.action?curPos=1&typeId=<s:property value='%{typeId}' />">首页</a>
	    					<a href="jsp_user_bookselect.action?curPos=<s:property value='%{curPos-@com.action.UserBookSelectAction@SIZE}' />&typeId=<s:property value='%{typeId}' />">上一页</a>
	    				</s:if>
	    				<s:else>
	    					首页 上一页
	    				</s:else>
	    				<s:if test="%{curPos!=nextPos}">	    							   	    				
	    					<a href="jsp_user_bookselect.action?curPos=<s:property value='%{nextPos}' />&typeId=<s:property value='%{typeId}' />">下一页</a>
	    					<a href="jsp_user_bookselect.action?curPos=<s:property value='%{cnt-cnt%@com.action.UserBookSelectAction@SIZE+1}' />&typeId=<s:property value='%{typeId}' />">尾页</a>
	    				</s:if>
	    				<s:else>
	    					下一页 尾页
	    				</s:else></span>
    		</div>    		
    		</s:else>  			
  	</div>
  	<!--  <div>
  		<table>
  		<s:iterator value="%{bookList}">
  				<tr>
  					<td>
  						<img width="80px" height="120px" alt="<s:property value='title' />" src="<s:property value='picturePath' />"/>
  					</td>
  					<td align="center">
  						<table>
  							<tr>
  								<td colspan="2" align="center"><s:property value="title"/></td>
  							</tr>
  							<tr>
  								<td>作者：</td>
  								<td><s:property value="author"/></td>
  							</tr>
  							<tr>
  								<td>单价：</td>
  								<td><s:property value="price"/></td>
  							</tr>
  							<tr>
  								<td>
  									<a href="jsp_user_bookdetail?bookId=<s:property value='%{bookId}' />">详情</a>
  								</td>
  								<td>
  									<a href="jsp_user_addshopcar.action?bookId=<s:property value='%{bookId}' />" target="centerframe">加入购物车</a>
  								</td>
  							</tr>
  						</table>
  					</td>
  				</tr>
  			</s:iterator>
    		<s:if test="%{cnt==0}">
    			<tr>
    				<td colspan="2">没有图书</td>
    			</tr>
    		</s:if>
    		<s:else>
	    		<tr>
	    			<td>共检索到<s:property value="cnt"/>条记录</td>
	    			<td>
	    				共<s:property value="%{cnt/@com.action.UserBookSelectAction@SIZE+(cnt%@com.action.UserBookSelectAction@SIZE!=0?1:0)}"/>页
	    				当前第<s:property value="%{curPos/@com.action.UserBookSelectAction@SIZE+1}" />页
	    				<s:if test="%{curPos!=1}">							
	    					<a href="jsp_user_bookselect.action?curPos=1&typeId=<s:property value='%{typeId}' />">首页</a>
	    					<a href="jsp_user_bookselect.action?curPos=<s:property value='%{curPos-@com.action.UserBookSelectAction@SIZE}' />&typeId=<s:property value='%{typeId}' />">上一页</a>
	    				</s:if>
	    				<s:else>
	    					首页 上一页
	    				</s:else>
	    				<s:if test="%{curPos!=nextPos}">	    							   	    				
	    					<a href="jsp_user_bookselect.action?curPos=<s:property value='%{nextPos}' />&typeId=<s:property value='%{typeId}' />">下一页</a>
	    					<a href="jsp_user_bookselect.action?curPos=<s:property value='%{cnt-cnt%@com.action.UserBookSelectAction@SIZE+1}' />&typeId=<s:property value='%{typeId}' />">尾页</a>
	    				</s:if>
	    				<s:else>
	    					下一页 尾页
	    				</s:else>
	    			</td>		    		
	    		</tr>	    		
    		</s:else>  			
  		</table>
  	</div>
  	-->
  </body>
</html>
